87908363d27babf29459d228abd51a4c2d326635,packaging/src/test/java/org/neo4j/server/osgi/bundles/consumer/WhovilleActivator.java,WhovilleActivator,start,#BundleContext#,37

Before Change



    public void start( BundleContext bundleContext ) throws Exception
    {
        hortonCommunicator = (ExampleHostService)bundleContext.getService( bundleContext.getServiceReference( ExampleHostService.class.toString()) );

        System.out.println( "OSGi service consumer bundle started" );
    }

After Change


    {
        this.bundleContext = bundleContext;

        synchronized (this)
        {
            bundleContext.addServiceListener(this);

            ServiceReference[] refs = bundleContext.getServiceReferences(
                ExampleHostService.class.getName(), null);

            if (refs != null)
            {
                hortonCommunicator = (ExampleHostService) bundleContext.getService(refs[0]);
                hortonCommunicator.askHorton( "Can you hear us?" );
            }
        }